package com.lyq.demo.redis.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.concurrent.Executor;

/**
 * @author lyq
 * @time 2019/5/11 22:09
 */
@Component
@Slf4j
public class QueueConsumer {

    @Autowired
    private Executor executor;

    @Autowired
    private RedisTemplate redisTemplate;

    @PostConstruct
    public void init(){
        executor.execute(() -> {
//            while(true){
//                Object list1 = redisTemplate.opsForList().rightPop("list1",5L, TimeUnit.SECONDS);
//                log.info("收到的消息={}",list1);
//            }
        });
    }

}
